<?php

Yii::import('common.models.db.CategoriesModel');

class FrontendCategoriesModel extends CategoriesModel
{
	public static function model($className=__CLASS__) {
		return parent::model($className);
	}
	public function behaviors()
	{
		return array('translate'=>'application.components.STranslateableBehavior' );
	}
	public function translate()
	{
		// List of model attributes to translate
		return array('title','alias'); //Example
	}
	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'news' => array(self::HAS_MANY, 'FrontendNewsModel', 'id', 'condition'=>'tbl_content.status='.FrontendNewsModel::STATUS_PUBLISHED, 'order'=>'tbl_content.created DESC'),
			'newsCount' => array(self::STAT, 'FrontendNewsModel', 'catid'),
		);
	}
}